package com.bw.medical.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bw.common.utils.R;
import com.bw.medical.dao.TbDiagnoseDao;
import com.bw.medical.entity.TbDepartmentEntity;
import com.bw.medical.entity.TbDiagnoseEntity;
import com.bw.medical.vo.InquiryVo;
import com.bw.medical.vo.Pojo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bw.common.utils.PageUtils;
import com.bw.common.utils.Query;

import com.bw.medical.dao.TbDockerLevelDao;
import com.bw.medical.entity.TbDockerLevelEntity;
import com.bw.medical.service.TbDockerLevelService;


@Service("tbDockerLevelService")
public class TbDockerLevelServiceImpl extends ServiceImpl<TbDockerLevelDao, TbDockerLevelEntity> implements TbDockerLevelService {
@Autowired
private TbDockerLevelDao tbDockerLevelDao;
@Autowired
private TbDiagnoseDao tbDiagnoseDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params, Integer departmentType, String docterName) {
        IPage<TbDockerLevelEntity> page = this.page(
                new Query<TbDockerLevelEntity>().getPage(params)
        );

        return new PageUtils(page);
    }

    @Override
    public R info(Integer departmentId) {
        List<TbDockerLevelEntity> info = tbDockerLevelDao.info(departmentId);
        R r = R.ok().put("list", info);
        return r;
    }

    @Override
    public IPage<TbDiagnoseEntity> getLista(Map<String, Object> params) {
        Page<TbDepartmentEntity> page = new Page<>(Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("limit").toString()));
        Integer docterAge=null;
        if (!params.get("docterAge").toString().equals("")){
            docterAge=Integer.valueOf(params.get("docterAge").toString());
        }
        Integer departmentType=null;
        if (!params.get("departmentType").toString().equals("")){
            docterAge=Integer.valueOf(params.get("departmentType").toString());
        }

        return tbDiagnoseDao.getLista(page, docterAge, (String)params.get("docterName"),
                Integer.valueOf(params.get("docterAudit").toString()),departmentType);

    }
    @Override
    public IPage<TbDockerLevelEntity> getLists(Map<String, Object> params) {
        Page<TbDockerLevelEntity> page = new Page<>(Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("limit").toString()));
        return baseMapper.getLists(page,(String)params.get("docterName"),Integer.valueOf(params.get("departmentType").toString()));
    }

    @Override
    public IPage<InquiryVo> getDoclist(InquiryVo vo, Integer page, Integer limit) {
        Page<InquiryVo> pa = new Page<>(page, limit);

        return baseMapper.getDoclist(pa,vo);
    }


}